﻿@{
    ViewBag.Title = "辅料添加";
}

<section class="content-header">
    <h1>
        辅料添加
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index","Home")">首页</a></li>
        <li class="active">辅料添加</li>
    </ol>
</section>

<section class="content">
    <form class="form-horizontal" method="post" id="formMain">
        <div class="box box-solid">
            <div class="box-body">
                <div class="row">
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="ProductName" class="col-sm-3 control-label">名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="ProductName" name="ProductName" maxlength="200">
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Number" class="col-sm-3 control-label">编号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Number" name="Number" maxlength="50">
                        </div>
                    </div>
                    @*<div class="form-group col-md-6 col-sm-12" >
                            <label for="Type" class="col-sm-3 control-label">类型</label>
                            <div class="col-sm-9">
                                <select class="form-control" id="Type" name="Type">
                                    <option value="2">主料</option>
                                    <option value="3">辅料</option>
                                </select>
                            </div>
                        </div>*@
                    @*<div class="form-group col-md-6 col-sm-12">
                            <label for="Type" class="col-sm-3 control-label">产品分类</label>
                            <div class="col-sm-9">
                                <select class="form-control" id="Type" name="Type">
                                    <option value="1"></option>
                                    <option value="2"></option>
                                </select>
                            </div>
                        </div>*@
                    <div class="form-group col-md-6 col-sm-12" style="display:none">
                        <label for="Format" class="col-sm-3 control-label">规格</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Format" name="Format" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Pack" class="col-sm-3 control-label">包装单位</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Pack" name="Pack" maxlength="50" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Unit" class="col-sm-3 control-label">基本单位</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Unit" name="Unit" maxlength="50" />
                        </div>
                    </div>

                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Width" class="col-sm-3 control-label">宽度-mm</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Width" name="Width" value="0"/>
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Length" class="col-sm-3 control-label">长度-mm</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Length" name="Length" value="0"/>
                        </div>
                    </div>

                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Price" class="col-sm-3 control-label">价格-元/基本单位</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Price" name="Price" value="0" />
                        </div>
                    </div>
                    <input style="display:none" id="Data" name="Data" />
                    <div id="json-content">
                        <div class="form-group col-md-6 col-sm-12" style="display:none">
                            <label for="Quantity" class="col-sm-3 control-label">起订量[PCS]</label>
                            <div class="col-sm-9">
                                <input type="number" class="form-control" id="Quantity" name="Quantity" data-des="起订量[PCS]" />
                            </div>
                        </div>
                        <div class="form-group col-md-6 col-sm-12">
                            <label for="Color" class="col-sm-3 control-label">颜色</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Color" name="Color" data-des="颜色" maxlength="50" />
                            </div>
                        </div>

                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Explain" class="col-sm-3 control-label">产品特点</label>
                        <div class="col-sm-9">
                            <textarea rows="3" class="form-control" id="Explain" name="Explain" maxlength="500"></textarea>
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Memo" class="col-sm-3 control-label">备注</label>
                        <div class="col-sm-9">
                            <textarea rows="3" class="form-control" id="Memo" name="Memo" maxlength="500"></textarea>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Creator" class="col-sm-3 control-label">创建人</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Creator" name="RealName" value="@ViewBag.RealName" readonly="readonly" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="CreateTime" class="col-sm-3 control-label">创建时间</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="CreateTime" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" readonly="readonly" />
                        </div>
                    </div>
                </div>

            </div>
            <div class="box-footer">
                <div class="box-footer">
                    <span class="btn btn-primary " onclick="FormSub()">确 定</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <a class="btn btn-primary" href="@Url.Action("Index","Material")">返 回</a>
                </div>
            </div>
        </div>
    </form>
</section>

@section Scripts {
    <script>

    //提交表单
    function FormSub() {
        var name = $("#ProductName").val().trim();
        if (name == "") {
            $.modalAlert("请输入名称", "warning");
            return false;
        }

        var number = $("#Number").val().trim();
        if (number == "") {
            $.modalAlert("请输入编号", "warning");
            return false;
        }

        var width = $("#Width").val().trim();
        if (width == "") {
            $.modalAlert("请输入宽度", "warning");
            return false;
        }

        var length = $("#Length").val().trim();
        if (length == "") {
            $.modalAlert("请输入长度", "warning");
            return false;
        }

        var price = $("#Price").val().trim();
        if (price == "") {
            $.modalAlert("请输入价格", "warning");
            return false;
        }

        $("#formMain").submit();
    }
    </script>
}
